
	dropdownList ddl_coordsys "Coordinate System" pos:[8,8] width:144 height:41 items:#("opengl", "d3d", "3dsmax")
	
	button btn_export_sel "Export Selected" pos:[8,64] width:144 height:24 toolTip:"Exports selected Ambient Cubes to a text file"

	local lastfilename = undefined
	
	on btn_export_sel pressed  do
	(
		def_filename = lastfilename
		
		if def_filename == undefined do def_filename = ""
		
		local filename = getSaveFileName \
			filename:def_filename \
			caption:"Export Selected..." \
			types:"AmbientCubes(*.mcube)|*.mcube|All (*.*)|*.*|" \
			historyCategory:"AmbientCubes"
		
		if filename != undefined do
		(
			format "export ambient cubes using coordsys: %\n" ddl_coordsys.selected
			
			fp = createFile filename
			
			export_ambient_cubes fp ddl_coordsys.selected
			
			close fp
			
			messageBox ("Ambient Cubes have been exported to:\n" + filename) title: "Export success :-)" beep:false
			
			lastfilename = filename
		)
	)
